<?php
class User_Service_Action
{

	public static function getByCondition($condition,$type='*',$order="", $pageSize=0, $page=1)
	{ 
		$obj=new User_Model_Action();
		$rows= $obj->getByCondition( $condition,$type,$order, $pageSize,$page);	
		return ($rows);
	}

	public static function getSelect()
	{ 
		$obj=new User_Model_Action();
		$rows= $obj->getAllModule();
		return ($rows);
	}

	public static function getByfield($field,$value)
	{ 
		$obj=new User_Model_Action();
		$rows= $obj->getByfield($field,$value);	
		return ($rows);
	}	
	
	
	public static function getById($ura_id)
	{ 
		$obj=new User_Model_Action();
		$rows=$obj->getById($ura_id);
		return $rows;
	}
	
	public static function getCount()
	{ 
		$obj=new User_Model_Action();
		return $obj->getCount();
	}

	public static function create($row)
	{ 
		$obj=new User_Model_Action();
		return $obj->create($row);
	}

	public static function update($row,$ura_id)
	{ 
		$obj=new User_Model_Action();
		return $obj->update($row,$ura_id);
	}	

	public static function delete($id)
	{ 
		$obj=new User_Model_Action();
		return $obj->delete($id);
	}

	public static function getRowByMCA($module,$controller,$action)
	{ 
		$obj=new User_Model_Action();
		return $obj->getRowByMCA($module,$controller,$action);
	}
	
	public static function getAllModule(){
		$obj=new User_Model_Action();
		return $obj->getAllModule();
	}
	
    public static function validator($val) {
        $error = array();
        $validateArr = array();
        $validateArr[] = array('name' => '标题', 'value' => $val['ura_title'], 'regex' => array('require', 'length[0,255]', ));
		$validateArr[] = array('name' => '模块', 'value' => $val['ura_module'], 'regex' => array('require', 'length[0,255]', ));
		$validateArr[] = array('name' => '控制器', 'value' => $val['ura_controller'], 'regex' => array('require', 'length[0,255]', ));
		$validateArr[] = array('name' => '方法', 'value' => $val['ura_action'], 'regex' => array('require', 'length[0,255]', ));
        $error = Common_Service_Validator::formValidator($validateArr);
        return $error;
    }
}
